package simple.charlie.rpc.rabbitmq.consumer;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@EnableRabbit
@Component
public class Consumer {
	@RabbitListener(queues = "rpc.rabbitmq.demo")
	public String receive(String message) {
		log.info("Received message: {}", message);
		try {
			Thread.sleep(10000);
		} catch (Exception e) {
			log.error("{}", e);
		}
		log.info("Return response: success");
		return "success";
	}
}
